$softwareList = @(
    @{ # WindowsTerminal
        Name = "WindowsTerminal"
        Description = "https://learn.microsoft.com/zh-cn/windows/terminal/install"
        Install = {
            $downloadUrl ="https://github.com/microsoft/terminal"
            Start-Process -FilePath  $downloadUrl;
            $downloadUrl ="https://learn.microsoft.com/zh-cn/windows/terminal/install";
            # Download-Url-File $downloadUrl;
            Start-Process -FilePath  $downloadUrl;
        }
        #  C:\Users\Alice\AppData\Local\Microsoft\WindowsApps\wt.exe
        Check = { which "wt" }
    }, 
    @{ # PowerShell7
        Name = "PowerShell7"
        Description = "https://github.com/PowerShell/PowerShell"
        Install = {
            $downloadUrl ="https://learn.microsoft.com/zh-cn/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.5"
            Start-Process -FilePath  $downloadUrl;
            $downloadUrl ="${githubProxyUrl}https://github.com/PowerShell/PowerShell/releases/download/v7.5.4/PowerShell-7.5.4-win-x64.msi"
            Download-Url-File $downloadUrl $OutputSavePath
        }
        #  C:\Users\Alice\AppData\Local\Microsoft\WindowsApps\wt.exe
        Check = {which "pwsh.exe"}
    }, 
    @{ # PSTools
        Name = "PSTools"
        Description = "psexec"
        Install = {
            # initMain3 "psexec.exe" "C:\Tools" `
            #     "https://download.sysinternals.com/files/PSTools.zip" "PSTools"
            # 下载
            $PSToolsEnv =  'C:\Tools\PSTools'
            $downloadUrl = "https://download.sysinternals.com/files/PSTools.zip"
            Download-Url-File $downloadUrl $OutputSavePath
            # 解压
            $cmd_string="Expand-Archive -Force -LiteralPath '$OutputSavePath\PSTools.zip' -DestinationPath $PSToolsEnv" # 在下载保存目录解
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令
            # 添加环境变量
            Add-EnvVars "Path" "${PSToolsEnv}\" "User"
        }
        Check = { which "psexec.exe" }
    },
    @{ # 重复文件查找工具 czkawka_cli
        Name = "czkawka_cli"
        Description = "https://github.com/qarmin/czkawka"
        Install = {
            initMain0-1 "czkawka_cli.exe" "C:\Tools\bin" `
                "${githubProxyUrl}https://github.com/qarmin/czkawka/releases/download/9.0.0/windows_czkawka_cli.exe"
        }
        Check = { which "czkawka_cli.exe" }
    },
    @{ # 压缩解压工具 zip/unzip
        Name = "zip/unzip"
        Description = "http://stahlworks.com"
        Install = {
            initMain0 "zip" "C:\Tools\bin" "http://stahlworks.com/dev/zip.exe"
            initMain0 "unzip" "C:\Tools\bin" "http://stahlworks.com/dev/unzip.exe"
        }
        Check = { (which "zip.exe") -and (which "unzip.exe") }
    },
    @{ # 压缩解压工具 7-zip
        Name = "7-zip"
        Description = "https://github.com/ip7z/7zip"
        Install = {
            # initMain6 "7z" "${githubProxyUrl}https://github.com/ip7z/7zip/releases/download/24.09/7z2409-x64.exe";
            initMain6 "7z" "https://www.7-zip.org/a/7z2501-x64.exe"
            Add-EnvVars "Path" "C:\Program Files\7-Zip\" "User"
        }
        Check = { which "7z" }
    },
    @{ # 压缩解压工具 7zr
        Name = "7zr"
        Description = "https://www.7-zip.org"
        Install = {
            initMain0 "7zr" "C:\Tools\bin" "https://www.7-zip.org/a/7zr.exe"
        }
        Check = { which "7zr.exe" }
    },
    @{ # 模糊查找工具 fzf
        Name = "fzf"
        Description = "https://github.com/junegunn/fzf"
        Install = {
            # - 模糊查找工具
            initMain1 "fzf" "C:\Tools\bin" "${githubProxyUrl}https://github.com/junegunn/fzf/releases/download/0.46.1/fzf-0.46.1-windows_amd64.zip" 

        }
        Check = { which "fzf" }
    },
    @{ # 阅读 Readest
        Name = "Readest"
        Description = "https://github.com/readest/readest"
        Install = {
            initMain0-1 "Readest.exe" "C:\Tools\bin"  `
                "${githubProxyUrl}https://github.com/readest/readest/releases/download/v0.9.23/Readest_0.9.23_x64-portable.exe"
        }
        Check = { which "Readest.exe" }
    },
    @{ # glint
        Name = "glint"
        Description = "https://github.com/brigand/glint"
        Install = {
            initMain0-1 "glint" "C:\Tools\bin" `
                "${githubProxyUrl}https://github.com/brigand/glint/releases/download/v6.3.4/glint-windows"
        }
        Check = { which "glint" }
    },

    @{  # - 下载 yt-dlp
        Name = "yt-dlp"
        Description = "https://github.com/yt-dlp/yt-dlp"
        Install = {
            initMain0-1 "yt-dlp.exe" "C:\Tools\bin" `
                "${githubProxyUrl}https://github.com/yt-dlp/yt-dlp/releases/download/2025.09.05/yt-dlp.exe"
        }
        Check = { which "yt-dlp.exe" }
    },
    @{  # - m3u8视频下载 N_m3u8DL-RE
        Name = "N_m3u8DL-RE"
        Description = "https://github.com/nilaoda/N_m3u8DL-RE"
        Install = {
            # - [nilaoda/N_m3u8DL-RE · GitHub](https://github.com/nilaoda/N_m3u8DL-RE/releases)
            # initMain1 "N_m3u8DL-RE" "C:\Tools\bin" "${githubProxyUrl}https://github.com/nilaoda/N_m3u8DL-RE/releases/download/v0.3.0-beta/N_m3u8DL-RE_v0.3.0-beta_win-x64_20241203.zip"
            initMain1 "N_m3u8DL-RE" "C:\Tools\bin" "${githubProxyUrl}https://github.com/nilaoda/N_m3u8DL-RE/releases/download/v0.5.1-beta/N_m3u8DL-RE_v0.5.1-beta_win-x64_20251029.zip"
        }
        Check = { which "N_m3u8DL-RE" }
    },
    @{  # - B站视频下载命令行工具 BBDown
        Name = "BBDown"
        Description = "https://github.com/nilaoda/BBDown"
        Install = {
            # - B站视频下载命令行工具
            initMain1 "BBDown" "C:\Tools\bin" "${githubProxyUrl}https://github.com/nilaoda/BBDown/releases/download/1.6.3/BBDown_1.6.3_20240814_win-x64.zip" 
            Check-And-CreateWrite-Config "C:\Tools\bin\BBDown.config" "--work-dir $HOME/Downloads `n --skip-ai False " # BBDown 配置
    
        }
        Check = { which "BBDown.exe" }
    },
    @{  # - 下载器 lux
        Name = "lux"
        Description = "https://github.com/iawia002/lux"
        Install = {
            initMain1 "lux" "C:\Tools\bin" "${githubProxyUrl}https://github.com/iawia002/lux/releases/download/v0.24.1/lux_0.24.1_Windows_x86_64.zip" 
        }
        Check = { which "lux.exe" }
    },
    @{ # termscp
        Name = "termscp"
        Description = "https://github.com/veeso/termscp"
        Install = {
            initMain1 "termscp" "C:\Tools\bin" "${githubProxyUrl}https://github.com/veeso/termscp/releases/download/v0.16.1/termscp-v0.16.1-x86_64-pc-windows-msvc.zip" 
            
        }
        Check = { which "termscp.exe" }
    },
    @{  # - 终端文件管理器 lf
        # [GitHub - gokcehan/lf: Terminal file manager](https://github.com/gokcehan/lf)
        Name = "lf"
        Description = "https://github.com/gokcehan/lf"
        Install = {
            initMain1 "lf" "C:\Tools\bin" "${githubProxyUrl}https://github.com/gokcehan/lf/releases/download/r34/lf-windows-amd64.zip" 
        }
        Check = { which "lf.exe" }
    },
    @{  # - 终端查看word
        # [GitHub - gokcehan/lf: Terminal file manager](https://github.com/gokcehan/lf)
        Name = "doxx"
        Description = "https://github.com/bgreenwell/doxx"
        Install = {
            initMain1 "doxx" "C:\Tools\bin" "${githubProxyUrl}https://github.com/bgreenwell/doxx/releases/download/v0.1.2/doxx-windows-x86_64.zip" 
        }
        Check = { which "doxx.exe" }
    },
    
    @{ # - 命令行输出美化 bat
        Name = "bat"
        Description = "https://github.com/sharkdp/bat"
        Install = {
            initMain3 "bat" "C:\Tools" "${githubProxyUrl}https://github.com/sharkdp/bat/releases/download/v0.25.0/bat-v0.25.0-x86_64-pc-windows-gnu.zip"  "bat-v0.25.0-x86_64-pc-windows-gnu"
        }
        Check = { which "bat.exe" }
    },
    @{  # - 终端文件管理器 yazi
        Name = "yazi"
        Description = "https://github.com/sxyazi/yazi"
        Install = {
            initMain3 "yazi" "C:\Tools" "${githubProxyUrl}https://github.com/sxyazi/yazi/releases/download/v25.4.8/yazi-x86_64-pc-windows-msvc.zip"  "yazi-x86_64-pc-windows-msvc"
        }
        Check = { which "yazi.exe" }
    },
    @{  # - git-cc
        Name = "git-cc"
        Description = "https://github.com/SKalt/git-cc"
        Install = {
            initMain5 "git-cc" "C:\Tools" "${githubProxyUrl}https://github.com/SKalt/git-cc/releases/download/v0.2.5/git-cc_0.2.5_windows_amd64.zip"  "git-cc_0.2.5_windows_amd64"

        }
        Check = { which "git-cc.exe" }
    },
    @{ # lua
        Name = "lua"
        Description = "https://github.com/rjpcomputing/luaforwindows"
        Install = {
            # - lua
            initMain6 "lua" "${githubProxyUrl}https://github.com/rjpcomputing/luaforwindows/releases/download/v5.1.5-52/LuaForWindows_v5.1.5-52.exe"
        }
        Check = { which "lua" }
    },
    @{  # - 快速跳转 z.lua
        Name = "z.lua"
        Description = "https://github.com/skywind3000/z.lua"
        Install = {
            initMain4 "z.lua" "C:\Tools" "${githubProxyUrl}https://github.com/skywind3000/z.lua/archive/refs/tags/1.8.20.zip" "z.lua-1.8.20"
        }
        Check = { (Test-Path -Path "C:\Tools\z.lua") }
    },
    @{  # 快速跳转 zoxide
        Name = "zoxide"
        Description = "https://github.com/ajeetdsouza/zoxide"
        Install = {
            initMain5 "zoxide" "C:\Tools" "${githubProxyUrl}https://github.com/ajeetdsouza/zoxide/releases/download/v0.9.7/zoxide-0.9.7-x86_64-pc-windows-msvc.zip"  "zoxide-0.9.7-x86_64-pc-windows-msvc"
            # zoxide import --from=z "${HOME}\.zlua" # z.lua将数据导入zoxide
        }
        Check = { which "zoxide" }
    },
    @{ # rg
        Name = "rg"
        Description = "https://github.com/BurntSushi/ripgrep"
        Install = {
            # [GitHub - BurntSushi/ripgrep: ripgrep recursively searches directories for a regex pattern while respecting your gitignore](https://github.com/BurntSushi/ripgrep)
            initMain5-1 "rg" "C:\Tools" "${githubProxyUrl}https://github.com/BurntSushi/ripgrep/releases/download/14.1.1/ripgrep-14.1.1-x86_64-pc-windows-msvc.zip" "ripgrep-14.1.1-x86_64-pc-windows-msvc"  "C:\Tools\ripgrep-14.1.1-x86_64-pc-windows-msvc"
        }
        Check = { which "rg" }
    },
    @{ # fd
        Name = "fd"
        Description = "https://github.com/sharkdp/fd"
        Install = {
            initMain5-1 "fd" "C:\Tools" "${githubProxyUrl}https://github.com/sharkdp/fd/releases/download/v10.1.0/fd-v10.1.0-x86_64-pc-windows-msvc.zip" "fd-v10.1.0-x86_64-pc-windows-msvc"  "C:\Tools\fd-v10.1.0-x86_64-pc-windows-msvc"
        
        }
        Check = { which "fd" }
    },
    @{ # ffmpeg
        Name = "ffmpeg"
        Description = "https://www.videohelp.com"
        Install = {
            # 方式二： 
            if ($OsVersion -eq 7) {
                # 注 如果是win7系统，ffmpeg不要用最新版本，可用4.4版本
                # [ffmpeg Old Versions Downloads - VideoHelp](https://www.videohelp.com/software/ffmpeg/old-versions)
                # https://www.videohelp.com/download/ffmpeg-4.4-full_build.7z
                initMain2 "ffmpeg" "C:\Tools\bin" "https://www.videohelp.com/download-wpnhGmBnMZr/ffmpeg-4.4-full_build.7z" "ffmpeg-4.4-full_build\bin"
            } else {
                initMain2 "ffmpeg" "C:\Tools\bin" "${githubProxyUrl}https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-lgpl.zip"  "ffmpeg-master-latest-win64-lgpl\bin"
            }
        }
        Check = { which "ffmpeg" }
    },
    @{ # magick
        Name = "gswin64c"
        Description = "https://master.dl.sourceforge.net/project/gssetinitialview/gswin64c-9.55.0-bin.zip?viasf=1"
        Install = {
            # gswin64c
            initMain3-1 "gswin64c" "C:\Tools" "https://master.dl.sourceforge.net/project/gssetinitialview/gswin64c-9.55.0-bin.zip?viasf=1"  "gswin64c-9.55.0-bin" #SourceForge 使用动态镜像，需添加 ?viasf=1 参数绕过重定向
        }
        Check = { which "gswin64c" }
    },
    @{ # magick
        Name = "magick"
        Description = "https://imagemagick.org"
        Install = {
            # ImageMagick
            initMain6 "magick" "https://imagemagick.org/archive/binaries/ImageMagick-7.1.2-1-Q16-HDRI-x64-dll.exe"
            # 国内站
            # initMain6 "magick" "https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-38-Q16-HDRI-x64-dll.exe"
            # initMain6 "magick" "${githubProxyUrl}https://github.com/ImageMagick/ImageMagick/releases/download/7.1.1-47/ImageMagick.Q16-HDRI.msixbundle"

            # initMain6 "magick" "${githubProxyUrl}https://github.com/ImageMagick/ImageMagick/releases/download/7.1.1-47/ImageMagick.Q16.msixbundle"
            # initMain6 "magick" "http://www.imagemagick.com.cn/download/ImageMagick-6.2.7-6-Q16-windows-dll.exe"
        
        }
        Check = { which "magick" }
    },
    @{ # nvim
        Name = "nvim"
        Description = "https://github.com/neovim/neovim"
        Install = {
            # - neovim
            initMain5-1 "nvim" "C:\Tools" "${githubProxyUrl}https://github.com/neovim/neovim/releases/download/v0.11.0/nvim-win64.zip" "nvim-win64" "C:\Tools\nvim-win64\bin"

        }
        Check = { which "nvim" }
    },
    @{ # vim
        Name = "vim"
        Description = "https://github.com/vim/vim-win32-installer"
        Install = {
            # - vim
            # [GitHub - vim/vim-win32-installer: Vim Win32 Installer](https://github.com/vim/vim-win32-installer/)
            # initMain6 "gvim" "https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x64_signed.exe"
            initMain5-1 "vim" "C:\Tools" "${githubProxyUrl}https://github.com/vim/vim-win32-installer/releases/download/v9.1.0/gvim_9.1.0_x64_signed.zip" "vim" "C:\Tools\vim\vim91"

        }
        Check = { which "vim" }
    },
    @{ # helix
        Name = "helix"
        Description = "https://github.com/helix-editor/helix"
        Install = {
            # - helix
            initMain5-1 "hx" "C:\Tools" "${githubProxyUrl}https://github.com/helix-editor/helix/releases/download/25.01.1/helix-25.01.1-x86_64-windows.zip" "helix-25.01.1-x86_64-windows"  "C:\Tools\helix-25.01.1-x86_64-windows"  
        }
        Check = { which "hx" }
    },
    @{ # pdftoppm
        Name = "pdftoppm"
        Description = "https://github.com/oschwartz10612/poppler-windows"
        Install = {
            # - pdftoppm
            initMain5-1 "pdftoppm" "C:\Tools" "${githubProxyUrl}https://github.com/oschwartz10612/poppler-windows/releases/download/v24.08.0-0/Release-24.08.0-0.zip" "poppler-24.08.0"  "C:\Tools\poppler-24.08.0\Library\bin"
       }
        Check = { which "pdftoppm" }
    },
    @{ # jq
        Name = "jq"
        Description = "https://github.com/jqlang/jq"
        Install = {
            # - jq
            # [Download jq](https://jqlang.org/download/)
            initMain0-1 "jq.exe" "C:\Tools\bin" "${githubProxyUrl}https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-windows-amd64.exe"
        }
        Check = { which "jq" }
    },
    @{ # resvg
        Name = "resvg"
        Description = "https://github.com/linebender/resvg"
        Install = {
            # - resvg
            # [GitHub - linebender/resvg: An SVG rendering library.](https://github.com/linebender/resvg)
            # https://github.com/linebender/resvg/releases/download/v0.44.0/resvg-explorer-extension.exe
            # https://github.com/linebender/resvg/releases/download/v0.44.0/viewsvg-win64.zip
            # https://github.com/linebender/resvg/releases/download/v0.44.0/resvg-win64.zip
            # https://github.com/linebender/resvg/releases/download/v0.44.0/usvg-win64.zip
            initMain1 "resvg.exe" "C:\Tools\bin" "${githubProxyUrl}https://github.com/linebender/resvg/releases/download/v0.44.0/resvg-win64.zip"
            initMain5 "viewsvg.exe" "C:\Tools" "${githubProxyUrl}https://github.com/linebender/resvg/releases/download/v0.44.0/viewsvg-win64.zip" "viewsvg-win64" 
            initMain1 "usvg.exe" "C:\Tools\bin" "${githubProxyUrl}https://github.com/linebender/resvg/releases/download/v0.44.0/usvg-win64.zip" 
            initMain0 "resvg-explorer-extension.exe" "C:\Tools\bin"  "${githubProxyUrl}https://github.com/linebender/resvg/releases/download/v0.44.0/resvg-explorer-extension.exe"
        }
        Check = { which "resvg" }
    },
    @{ # sd
        Name = "sd"
        Description = "https://github.com/chmln/sd"
        Install = {
            # - 直观的查找和替换CLI（sed替代方案） sd
            # [GitHub - chmln/sd: Intuitive find & replace CLI (sed alternative)](https://github.com/chmln/sd)
            initMain5-1 "sd" "C:\Tools" "${githubProxyUrl}https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-pc-windows-msvc.zip" "sd-v1.0.0-x86_64-pc-windows-msvc"  "C:\Tools\sd-v1.0.0-x86_64-pc-windows-msvc"

        }
        Check = { which "sd" }
    },
    @{ # gum
        Name = "gum"
        Description = "https://github.com/charmbracelet/gum"
        Install = {
            # - 美观实用的终端界面 gum
            # https://github.com/charmbracelet/gum/releases/download/v0.16.0/gum_0.16.0_Windows_x86_64.zip
            initMain5-1 "gum" "C:\Tools" "${githubProxyUrl}https://github.com/charmbracelet/gum/releases/download/v0.16.0/gum_0.16.0_Windows_x86_64.zip" "gum_0.16.0_Windows_x86_64"  "C:\Tools\gum_0.16.0_Windows_x86_64"
        }
        Check = { which "gum" }
    },
    @{ # delta
        Name = "delta"
        Description = "https://github.com/dandavison/delta"
        Install = {
            # 用于 git、diff 和 grep 输出的语法高亮分页器 delta
            initMain5-1 "delta" "C:\Tools" "${githubProxyUrl}https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-pc-windows-msvc.zip" "delta-0.18.2-x86_64-pc-windows-msvc"  "C:\Tools\delta-0.18.2-x86_64-pc-windows-msvc"

        }
        Check = { which "delta" }
    },
    @{ # 命令行录制工具 vhs
        Name = "vhs"
        Description = "https://github.com/charmbracelet/vhs"
        Install = {
            # 命令行录制工具 用于将终端的操作过程录制成视频 vhs
            # https://github.com/charmbracelet/vhs/
            initMain5-1 "vhs" "C:\Tools" "${githubProxyUrl}https://github.com/charmbracelet/vhs/releases/download/v0.9.0/vhs_0.9.0_Windows_x86_64.zip" "vhs_0.9.0_Windows_x86_64"  "C:\Tools\vhs_0.9.0_Windows_x86_64"
        }
        Check = { which "vhs" }
    },
    @{ # 快速磁盘使用率 gdu
        Name = "gdu"
        Description = "https://github.com/dundee/gdu"
        Install = {
            # - 用Go编写控制台界面的快速磁盘使用率分析器 gdu
            # https://github.com/dundee/gdu/
            initMain1-1 "gdu.exe" "C:\Tools\bin" "${githubProxyUrl}https://github.com/dundee/gdu/releases/download/v5.30.1/gdu_windows_amd64.exe.zip"  "gdu_windows_amd64.exe"
        }
        Check = { which "gdu" }
    },
    @{ # dust
       # [GitHub - bootandy/dust: A more intuitive version of du in rust](https://github.com/bootandy/dust)
        Name = "dust"
        Description = "https://github.com/bootandy/dust"
        Install = {
            initMain5-1 "dust" "C:\Tools" "${githubProxyUrl}https://github.com/bootandy/dust/releases/download/v1.2.0/dust-v1.2.0-x86_64-pc-windows-msvc.zip" "dust-v1.2.0-x86_64-pc-windows-msvc"  "C:\Tools\dust-v1.2.0-x86_64-pc-windows-msvc"
        
        }
        Check = { which "dust" }
    },
    @{ # dua
        Name = "dua"
        Description = "https://github.com/Byron/dua-cli"
        Install = {
            # - dua
            initMain5-1 "dua" "C:\Tools" "${githubProxyUrl}https://github.com/Byron/dua-cli/releases/download/v2.30.0/dua-v2.30.0-x86_64-pc-windows-msvc.zip" "dua-v2.30.0-x86_64-pc-windows-msvc"  "C:\Tools\dua-v2.30.0-x86_64-pc-windows-msvc"
        }
        Check = { which "dua" }
    },
    @{ # 下载 axel
        Name = "axel"
        Description = "https://github.com/nishad/axel-for-windows"
        Install = {
            # - axel
            initMain4 "axel"  "C:\Tools" "${githubProxyUrl}https://github.com/nishad/axel-for-windows/archive/refs/heads/master.zip"  "axel-for-windows-master"
        }
        Check = { which "axel" }
    },
    @{ # 版本控制系统 git
        Name = "git"
        Description = "https://github.com/git-for-windows/git"
        Install = {
            initMain6 "git" `
                "${githubProxyUrl}https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe"
        }
        Check = { which "git.exe" }
    },
    @{ # gitui
        Name = "gitui"
        Description = "https://github.com/gitui-org/gitui"
        Install = {
            # initMain1 "gitui" "C:\Tools\bin" "${githubProxyUrl}https://github.com/gitui-org/gitui/releases/download/v0.27.0/gitui-win.tar.gz"
            initMain6  "gitui" "${githubProxyUrl}https://github.com/gitui-org/gitui/releases/download/v0.27.0/gitui-win.msi"
 
        }
        Check = { which "gitui" }
    },
    @{ # pyenv
        Name = "pyenv"
        Description = "https://github.com/pyenv-win/pyenv-win"
        Install = {
            #  定义变量
            $PyEnvDir = "C:\Tools\pyenv" # 安装位置变量
            $PyEnvWinDir = "${PyEnvDir}\pyenv-win"
            $BinPath = "${PyEnvWinDir}\bin"
            $ShimsPath = "${PyEnvWinDir}\shims"

            
            # 下载
            $downloadUrl = "${githubProxyUrl}https://github.com/pyenv-win/pyenv-win/archive/refs/heads/master.zip"
            Download-Url-File $downloadUrl $OutputSavePath
            if ( (Test-Path -Path $PyEnvDir) ) {# 目标目录（如果不存在）
                $cmd_string="Remove-Item -Recurse -Force $PyEnvDir" # 删除
                XWrite-Host "INFO" "cmd_string = $cmd_string"
                Invoke-Expression $cmd_string # 执行命令
            }
            # 解压到指定文件夹并重命名
            $cmd_string="Expand-Archive -Force -LiteralPath '$OutputSavePath\pyenv-win.zip' -DestinationPath $OutputSavePath" # 在目录解
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令

            # 移动
            $cmd_string="Move-Item -Path $OutputSavePath\pyenv-win-master -Destination $PyEnvDir" # 拷贝文件到对应目录下
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令

            # 重命名
            if ( (Test-Path -Path '$PyEnvDir\pyenv-win-master') ) {# 目标目录（如果不存在）
                $cmd_string="Rename-Item -Path '$PyEnvDir\pyenv-win-master' -NewName $PyEnvWinDir "
                XWrite-Host "INFO" "cmd_string = $cmd_string"
                Invoke-Expression $cmd_string # 执行命令
            }
            #  定义变量
            $targetDir = "${PyEnvWinDir}\install_cache"
            if (-not (Test-Path -Path $targetDir)) {# 创建目标目录（如果不存在）
                New-Item -Path $targetDir -ItemType Directory -Force | Out-Null
                XWrite-Host "INFO" "A directory has been created: $targetDir" -ForegroundColor Cyan # 已创建目录
            }
            
            # $pythonVersion = [System.Uri]$downloadUrl.Segments[-1]
            # 镜像地址
            # $pythonProxyUrl = "https://mirrors.huaweicloud.com/python" # 华为云镜像地址
            $pythonProxyUrl = "https://registry.npmmirror.com/-/binary/python"
            if ($OsVersion -eq 7) {
                # python 3.8.9 是最后支持windows7的版本
                $pythonVersion = "3.8.9"
                # $downloadUrl = "https://mirrors.huaweicloud.com/python/3.8.9/python-3.8.9-amd64.exe"
                # $downloadUrl = "https://registry.npmmirror.com/-/binary/python/3.10.9/python-3.10.9-amd64.exe"
                $downloadUrl = "$pythonProxyUrl/$pythonVersion/python-$pythonVersion-amd64.exe"
            } else {
                # python 3.10.9
                $pythonVersion = "3.10.9"
                # $downloadUrl = "https://mirrors.huaweicloud.com/python/3.10.9/python-3.10.9-amd64.exe"
                $downloadUrl = "$pythonProxyUrl/$pythonVersion/python-$pythonVersion-amd64.exe"
            }
            #  下载
            Download-Url-File $downloadUrl $OutputSavePath
            # 复制/移动
            # $cmd_string="Move-Item -Path $OutputSavePath\python-$pythonVersion-amd64.exe -Destination $targetDir" # 移动文件到对应目录下
            $cmd_string="Copy-Item -Path $OutputSavePath\python-$pythonVersion-amd64.exe -Destination $targetDir" # 拷贝文件到对应目录下
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令

            # # 打印下一步操作
            Write-Host "pyenv install $pythonVersion"
            Write-Host "pyenv global $pythonVersion"
            # Write-Host "windows10/11 去 设置 ->应用和功能 -> 应用执行名 —>关掉 python.exe"
            Write-Host "Windows 10/11, Go to Settings -> Apps & Features -> App Execution Name -> Turn off python.exe python3.exe"
            Write-Host "pip config set global.index-url https://pypi.mirrors.ustc.edu.cn/simple/"

            # 添加环境变量
            Add-EnvVars "Path" "${BinPath}\" "User"
            Add-EnvVars "PYENV" "${PyEnvWinDir}\" "User"
            Add-EnvVars "PYENV_ROOT" "${PyEnvWinDir}\" "User"
            Add-EnvVars "PYENV_HOME" "${PyEnvWinDir}\" "User"
            # Add-EnvVars "Path" "${ShimsPath}" "User"
            Add-EnvVars "Path" "%PYENV_ROOT%\shims\" "User"


        }
        Check = { which "pyenv" }
    },
    @{ # you-get
        Name = "you-get"
        Description = "https://github.com/soimort/you-get"
        Install = {
            pip install you-get
            # 显示安装位置
            python -m pip show you-get
            # 获取当前python版本加入环境变量
            $pyVersion = ""
            if (Get-Command python -ErrorAction SilentlyContinue) {
                $verOutput = python --version 2>&1
                if ($verOutput -match 'Python (\d+\.\d+\.\d+)') {
                    $pyVersion = "[P$($matches[1])] "
                    Add-EnvVars "Path" "C:\Tools\pyenv\pyenv-win\versions\${pyVersion}\Scripts" "User"
                }
            }
        }
        Check = { which "you-get" }
    },
    @{ # musicdl
        Name = "muiscdl"
        Description = "https://github.com/CharlesPikachu/musicdl"
        Install = {
            # pip install pymusicdl
            pip install musicdl
            # 显示安装位置
            python -m pip show musicdl 
            # 获取当前python版本加入环境变量
            $pyVersion = ""
            if (Get-Command python -ErrorAction SilentlyContinue) {
                $verOutput = python --version 2>&1
                if ($verOutput -match 'Python (\d+\.\d+\.\d+)') {
                    $pyVersion = "[P$($matches[1])] "
                    Add-EnvVars "Path" "C:\Tools\pyenv\pyenv-win\versions\${pyVersion}\Scripts" "User"
                    # Add-EnvVars "Path" "C:\Tools\pyenv\pyenv-win\versions\${pyVersion}\Lib\site-packages\pymusicdl" "User"
                }
            }
        }
        Check = { which "musicdl" }
    },
    @{ # musicdl
        Name = "videodl"
        Description = "https://github.com/CharlesPikachu/videodl"
        Install = {
            pip install videofetch
            # 显示安装位置
            python -m pip show videofetch 
            # 获取当前python版本加入环境变量
            $pyVersion = ""
            if (Get-Command python -ErrorAction SilentlyContinue) {
                $verOutput = python --version 2>&1
                if ($verOutput -match 'Python (\d+\.\d+\.\d+)') {
                    $pyVersion = "[P$($matches[1])] "
                    Add-EnvVars "Path" "C:\Tools\pyenv\pyenv-win\versions\${pyVersion}\Scripts" "User"
                }
            }
        }
        Check = { which "videodl" }
    },
    @{ # musicdl
        Name = "noveldl"
        Description = "https://github.com/CharlesPikachu/noveldl"
        Install = {
            pip install pynoveldl
            # 显示安装位置
            python -m pip show pynoveldl 
            # 获取当前python版本加入环境变量
            $pyVersion = ""
            if (Get-Command python -ErrorAction SilentlyContinue) {
                $verOutput = python --version 2>&1
                if ($verOutput -match 'Python (\d+\.\d+\.\d+)') {
                    $pyVersion = "[P$($matches[1])] "
                    Add-EnvVars "Path" "C:\Tools\pyenv\pyenv-win\versions\${pyVersion}\Scripts" "User"
                }
            }
        }
        Check = { which "noveldl" }
    },
    @{ # lazygit
        Name = "lazygit"
        Description = "https://github.com/jesseduffield/lazygit"
        Install = {
            # - git命令行工具 lazygit
            if ($OsVersion -eq 7) {
                # win7 
                initMain1 "lazygit" "C:\Tools\bin" "${githubProxyUrl}https://github.com/jesseduffield/lazygit/releases/download/v0.42.0/lazygit_0.42.0_Windows_x86_64.zip"  
            } else {
                initMain1 "lazygit" "C:\Tools\bin" "${githubProxyUrl}https://github.com/jesseduffield/lazygit/releases/download/v0.49.0/lazygit_0.49.0_Windows_x86_64.zip"  
            }
        }
        Check = { which "lazygit.exe" }
    },
    @{ # 对比同步文件 freefilesync
        Name = "freefilesync"
        Description = "https://freefilesync.org/download.php"
        Install = {
            ## freefilesync
            # 下载地址：https://freefilesync.org/download.php
            # initMain6 'freefilesync' 'https://freefilesync.org/download/FreeFileSync_14.3_Windows_Setup.exe'; # 静默安装只能商业版
            $downloadUrl = "https://freefilesync.org/download/FreeFileSync_14.3_Windows_Setup.exe";
            Download-Url-File $downloadUrl  $OutputSavePath
        }
        Check = { (Test-Path -Path "C:\Program Files\FreeFileSync") }
    },
    @{ # 局域网传输 LocalSend
       # [LocalSend - 下载](https://localsend.org/zh-CN/download)
        # https://github.com/localsend/localsend
        Name = "localSend"
        Description = "https://github.com/localsend/localsend"
        Install = {
            if ($OsVersion -eq 7) {
                #LocalSend-1.15.4-windows-x86-64_win7
                initMain6 'localSend' "${githubProxyUrl}https://github.com/localsend/localsend/releases/download/v1.15.4/LocalSend-1.15.4-windows-x86-64.exe";
            } else {
                initMain6 'localSend' 'https://d.localsend.org/LocalSend-1.17.0-windows-x86-64.exe';
            }
        }
        Check = {  (Test-Path -Path "C:\Program Files\LocalSend\localsend_app.exe") }
    },
    @{ # 显示当前网速、CPU及内存利用率的桌面悬浮窗软件 TrafficMonitor
        # https://github.com/zhongyang219/TrafficMonitor
        Name = "TrafficMonitor"
        Description = "https://github.com/zhongyang219/TrafficMonitor"
        Install = {
            $downloadUrl = "${githubProxyUrl}https://github.com/zhongyang219/TrafficMonitor/releases/download/V1.85.1/TrafficMonitor_V1.85.1_x64.zip";
            Download-Url-File $downloadUrl  $OutputSavePath;
            $softwareVersionName = $downloadUrl -split '/' | Where-Object { $_ } | Select-Object -Last 1 # 获取最后一节字符串
            $ToolsEnv = "C:\Tools"
            # 解压
            $cmd_string="Expand-Archive -Force -LiteralPath '$OutputSavePath\$softwareVersionName' -DestinationPath $ToolsEnv" # 在下载保存目录解
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令
            # 复制配置文件
            $ProjectRoot = Split-Path -Path $PSScriptRoot # 获取上级父目录地址
            $cmd_string="Copy-Item -Path '$ProjectRoot\config\config.ini' -Destination '$ToolsEnv\TrafficMonitor'" # 拷贝文件到对应目录下
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令
            $cmd_string="Copy-Item -Path '$ProjectRoot\config\global_cfg.ini' -Destination '$ToolsEnv\TrafficMonitor'" # 拷贝文件到对应目录下
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令
        }
        Check = { (Test-Path -Path "C:\Tools\TrafficMonitor")  }
    },
    @{ # 下载工具： Neat-Download-Manager
        Name = "Neat-Download-Manager"
        Description = "https://neatdownload.com/"
        Install = {
            # [Neat Download Manager](https://neatdownload.com/)
            # https://github.com/Neatdownloadmanager/Neat-Download-Manager/releases
            # $downloadUrl = 'https://www.neatdownloadmanager.com/file/NeatDM_setup.exe';
            # Download-Url-File $downloadUrl;
            initMain6 "neatdownloadmanager" "https://www.neatdownloadmanager.com/file/NeatDM_setup.exe"
        }
        Check = {(Test-Path -Path "C:\Program Files (x86)\Neat Download Manager\NeatDM.exe")  }
    },
    @{ # node 版本管理器 nodejs 
        Name = "nvm"
        Description = "https://github.com/coreybutler/nvm-windows"
        Install = {
            initMain6 "nvm" "${githubProxyUrl}https://github.com/coreybutler/nvm-windows/releases/download/1.2.2/nvm-setup.exe"

            $downloadUrl = "https://nodejs.org/dist/v22.18.0/node-v22.18.0-win-x64.zip"
            Download-Url-File $downloadUrl $OutputSavePath
            # 离线下载安装指定版本nodejs
            # $nvmEnvDir = "C:\Users\{用户名}\AppData\Roaming\nvm"
            # $nvmEnvDir = "$HOME\AppData\Roaming\nvm"
            $nvmEnvDir = "$HOME\AppData\Loca\nvm"
            
            if ( (Test-Path -Path $nvmEnvDir) ) {# 目标目录（如果不存在）
                $cmd_string="Remove-Item -Recurse -Force $nvmEnvDir" # 删除
                XWrite-Host "INFO" "cmd_string = $cmd_string"
                Invoke-Expression $cmd_string # 执行命令
            }
            # 复制/移动
            $cmd_string="Copy-Item  -Path $OutputSavePath\node-v22.18.0-win-x64.zip -Destination $nvmEnvDir" # 拷贝文件到对应目录下
            XWrite-Host "INFO" "cmd_string = $cmd_string"
            Invoke-Expression $cmd_string # 执行命令

            # # 打印下一步操作
            Write-Host "nvm node_mirror https://npmmirror.com/mirrors/node/"
            Write-Host "nvm npm_mirror https://npmmirror.com/mirrors/npm/"

            Write-Host "nvm use 22.18.0"
        }
        Check = { which "nvm" }
    },
   @{ #  终端窗口管理
        Name = "tuios"
        Description = "https://github.com/Gaurav-Gosain/tuios"
        Install = {
            $downloadUrl = "${githubProxyUrl}https://github.com/Gaurav-Gosain/tuios/releases/download/v0.3.4/tuios_0.3.4_Windows_x86_64.tar.gz";
            Download-Url-File $downloadUrl;
            # Start-Process -FilePath $downloadUrl
            initMain3 "tuios" "C:\Tools" "${githubProxyUrl}https://github.com/Gaurav-Gosain/tuios/releases/download/v0.3.4/tuios_0.3.4_Windows_x86_64.tar.gz" "tuios_0.3.4_Windows_x86_64";
        }
        Check = { which "tuios.exe"  }
    },
    
    @{ # chafa
        Name = "chafa"
        Description = "https://hpjansson.org/chafa"
        Install = {
            # - 图片终端预览 imgcat
            # initMain5 "imgcat" "C:\Tools" "${githubProxyUrl}https://github.com/danielgatis/imgcat/releases/download/v1.0.21/imgcat_1.0.21_windows_amd64.zip" "imgcat_1.0.21_windows_amd64" 
            # -  图片终端预览 chafa
            initMain5-1 "chafa" "C:\Tools" "https://hpjansson.org/chafa/releases/static/chafa-1.14.5-1-x86_64-windows.zip" "chafa-1.14.5-1-x86_64-win"  "C:\Tools\chafa-1.14.5-1-x86_64-win"
         
        }
        Check = { which "chafa" }
    }
    # 添加更多软件项...
    #  - [GnuWin - Browse /sed at SourceForge.net](https://sourceforge.net/projects/gnuwin32/files/sed/)
    #      - [windows - sed  ](https://udomain.dl.sourceforge.net/project/gnuwin32/sed/4.2.1/sed-4.2.1-bin.zip)
    #  - [GnuWin - Browse /gawk at SourceForge.net](https://sourceforge.net/projects/gnuwin32/files/gawk/)
    #      - [windows - gawk ](https://udomain.dl.sourceforge.net/project/gnuwin32/gawk/3.1.6-1/gawk-3.1.6-1-bin.zip)
    #  - [GnuWin - Browse /grep at SourceForge.net](https://sourceforge.net/projects/gnuwin32/files/grep/)
    #      - [windows - grep ](https://udomain.dl.sourceforge.net/project/gnuwin32/grep/2.5.4/grep-2.5.4-setup.exe)
    #      - [windows - grep ](https://udomain.dl.sourceforge.net/project/gnuwin32/grep/2.5.4/grep-2.5.4-1-bin.zip)

)